//
//  ActivityNetWork.m
//  Shengzhuli
//
//  Created by subook on 2017/9/11.
//  Copyright © 2017年 kamangkeji. All rights reserved.
//

#import "ActivityNetWork.h"
#import "GFXNetworkHandle.h"


NSString * const AddActivityValue = @"auth/user/add/active/value";//分享活动增加活跃值L
NSString * const ActivityAccount = @"auth/active/value/account";//活跃值账户L

NSString * const ActivityRecord = @"auth/list/activeValue";//活跃值记录L

NSString * const ActivityGoodsList = @"product/active/value/list";//活跃值商品列表L
NSString * const ActivityGoodsDetail = @"product/active/value/detail";//活跃值商品详情L
NSString * const ActivityExchangeGoods = @"auth/active/value/buy/create";//活跃值兑换商品L

NSString * const HaveChangedGoodsList = @"auth/buy/product/active/value/list";//app端兑换的商品L清单列表L

NSString * const  HaveChangedGoodsDetail= @"auth/active/value/buy/product/details";//兑换商品的详情L

@implementation ActivityNetWork

//分享增加活跃值
+ (void)getShareCountWithParame:(NSDictionary *)parames response:(void (^)(BOOL success,NSString *msg))response
{
    [[GFXNetworkHandle shareHandle]post:AddActivityValue params:parames success:^(id json) {
        
        if ([json[@"status"] isEqualToString:SuccessStatus]) {
            
            response(YES,json[@"message"]);
        }else{
            response(NO,json[@"message"]);
        }
    } failure:^(NSError *error) {
        response(NO,NetworkError);
        NSLog(@"失败");
    }];
}
//活跃值账户
+ (void)getActivityAccountWithParame:(NSDictionary *)parames response:(void (^)(BOOL success,NSString *msg,NSDictionary *dcit))response
{
    [[GFXNetworkHandle shareHandle]post:ActivityAccount params:parames success:^(id json) {
        if ([json[@"status"] isEqualToString:SuccessStatus]) {
            
            response(YES,json[@"message"],json[@"result"]);
        }else{
            response(NO,json[@"message"],nil);
        }
    } failure:^(NSError *error) {
        response(NO,NetworkError,nil);
    }];
}
//活跃值记录
+ (void)getActivityRecordyWithParame:(NSDictionary *)parames response:(void (^)(BOOL, NSString *, NSArray *recordArr))response {
    [[GFXNetworkHandle shareHandle]post:ActivityRecord params:parames success:^(id json) {
        if ([json[@"status"] isEqualToString:SuccessStatus]) {
            
            response(YES,json[@"message"],json[@"result"]);
        }else{
            response(NO,json[@"message"],nil);
        }
    } failure:^(NSError *error) {
        response(NO,NetworkError,nil);
    }];
    
}
//活跃值商品列表
+ (void)getActivityGoodsListWithParame:(NSDictionary *)parames response:(void (^)(BOOL success,NSString *msg,NSArray *moneyArr))response {
    
    [[GFXNetworkHandle shareHandle]post:ActivityGoodsList params:parames success:^(id json) {
        if ([json[@"status"] isEqualToString:SuccessStatus]) {
            response(YES,json[@"message"],json[@"result"]);
        }else{
            response(NO,json[@"message"],nil);
        }
    } failure:^(NSError *error) {
        response(NO,NetworkError,nil);
    }];

}
//app端兑换的商品清单列表
+ (void)getHaveChangedGoodsListWithParame:(NSDictionary *)parames response:(void (^)(BOOL success,NSString *msg,NSArray *moneyArr))response {
    
    [[GFXNetworkHandle shareHandle]post:HaveChangedGoodsList params:parames success:^(id json) {
        
        if ([json[@"status"] isEqualToString:SuccessStatus]) {
            
            response(YES,json[@"message"],json[@"result"]);
        }else{
            response(NO,json[@"message"],nil);
        }
    } failure:^(NSError *error) {
        response(NO,NetworkError,nil);
    }];
    
}
//兑换商品的详情

+ (void)getHaveChangedGoodsDetailWithParame:(NSDictionary *)parames response:(void (^)(BOOL success,NSString *msg,NSDictionary *dict))response {
    [[GFXNetworkHandle shareHandle]post:HaveChangedGoodsDetail params:parames success:^(id json) {
        
        if ([json[@"status"] isEqualToString:SuccessStatus]) {
            response(YES,json[@"message"],json[@"result"]);
        }else{
            response(NO,json[@"message"],nil);
        }
    } failure:^(NSError *error) {
        response(NO,NetworkError,nil);
    }];
}
//活跃值兑换商品
+ (void)getActivityExchangeGoodsWithParame:(NSDictionary *)parames response:(void (^)(BOOL, NSString *,NSString *errorCode, AddGoodsModel *gooodsModel))response {
    [[GFXNetworkHandle shareHandle]post:ActivityExchangeGoods params:parames success:^(id json) {
        if ([json[@"status"] isEqualToString:SuccessStatus]) {
            
            AddGoodsModel *gooodsModel = [AddGoodsModel objectWithDict:json[@"result"]];
            response(YES,json[@"message"],json[@"status"],gooodsModel);
        }else{
            
            response(NO,json[@"message"],json[@"status"],nil);
        }
    } failure:^(NSError *error) {
        
        response(NO,NetworkError,nil,nil);
    }];
    
}
////活跃值商品详情
+(void)getActivityGoodsDetailWithParame:(NSDictionary *)parames response:(void (^)(BOOL, NSString *,NSString *errorCode, AddGoodsModel *gooodsModel))response {
    [[GFXNetworkHandle shareHandle]post:ActivityGoodsDetail params:parames success:^(id json) {
        if ([json[@"status"] isEqualToString:SuccessStatus]) {
            AddGoodsModel *gooodsModel = [AddGoodsModel objectWithDict:json[@"result"]];
            response(YES,json[@"message"],json[@"status"],gooodsModel);
        }else{
            response(NO,json[@"message"],json[@"status"],nil);
        }
    } failure:^(NSError *error) {
        response(NO,NetworkError,nil,nil);
    }];
}

@end
